from django.conf import settings
from django.db import models
from utils.models import CoreModel
from system.project.models import Channel

table_prefix = settings.TABLE_PREFIX


class Alarm(CoreModel):
    project = models.CharField(max_length=64, verbose_name='报警项目')
    title = models.CharField(max_length=64, verbose_name='报警标题')
    alarm_time = models.CharField(max_length=64)
    content = models.TextField(verbose_name='报警内容')
    channel = models.ForeignKey(Channel, to_field='id', on_delete=models.CASCADE, verbose_name='报警渠道')

    class Meta:
        db_table = table_prefix + 'alarm'
        verbose_name = '微信报警信息'
        verbose_name_plural = verbose_name
